HTML 77.2%
TypeScript 10.5%
Python 9.6%
JavaScript 2.5%
1import { ImageResponse } from 'next/og';2import { Fallback, Wallpaper } from '@/components/brand/og';3import { apiD1, safe } from '@/lib/api';4import { fmtDate, fmtParams, fmtTokens, num } from '@/lib/format';5import { routes, SITE_NAME } from '@/lib/site';67export const runtime = 'nodejs';8export const alt = `Model on ${SITE_NAME}`;9export const size = { width: 1200, height: 630 };10export const contentType = 'image/png';1112/** Per-model Open Graph image: wallpaper with "Model · Org", name, identity subtitle and counters params · active · context · released. */13export default async function ModelOgImage({ params }: { params: Promise<{ slug: string }> }) {14 const { slug } = await params;15 const d = await safe(apiD1.model(slug));16 if (!d || d.entity_type === 'artifact') return new ImageResponse(<Fallback label="Model" />, { ...size });17 const a = d.attributes ?? {};18 const counters: [string, string][] = [];19 if (num(a.parameter_count) !== null) counters.push(['Parameters', fmtParams(a.parameter_count)]);20 if (num(a.active_parameter_count) !== null && num(a.active_parameter_count) !== num(a.parameter_count)) counters.push(['Active', fmtParams(a.active_parameter_count)]);21 if (num(a.context_length) !== null) counters.push(['Context', `${fmtTokens(a.context_length)} tokens`]);22 if (typeof a.release_date === 'string') counters.push(['Released', fmtDate(a.release_date)]);23 const licence = d.licence && 'key' in d.licence && d.licence.key ? d.licence.key : null;24 const subtitle = [d.openness?.label ?? null, licence ? `licence ${licence}` : null, d.deployments?.length ? `${d.deployments.length} provider deployment${d.deployments.length === 1 ? '' : 's'}` : null, d.benchmarks?.items.length ? `${d.benchmarks.items.length} benchmarks` : null].filter(Boolean).join(' · ') || d.description?.slice(0, 110) || 'Specifications, prices, benchmarks, lineage and sources.';25 return new ImageResponse(<Wallpaper eyebrow={d.organization ? `Model · ${d.organization.name}` : 'Model'} title={d.name} subtitle={subtitle} counters={counters.slice(0, 4)} footer={`www.ai-atlas.co${routes.entity(d)}`} markPx={220} />, { ...size });26}27